package main;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import tree.Simulation;
import draw.DrawPanel;

public class KeyController implements KeyListener{

	private Simulation sim;
	private DrawPanel panel;
	
	public KeyController(Simulation sim,DrawPanel panel){
		this.sim = sim;
		this.panel = panel;
	}
	
	@Override
	public void keyPressed(KeyEvent e) {
		System.out.println("spacccee");
		if(e.getKeyCode() == KeyEvent.VK_SPACE)
			sim.startstop();
		if(e.getKeyCode() == KeyEvent.VK_ENTER)
			sim.reset();
		if(e.getKeyCode() == KeyEvent.VK_ESCAPE)
			System.exit(0);
		if(e.getKeyCode() == KeyEvent.VK_1){
			panel.drawDebug ^= true;
		}
		
	}

	@Override
	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

}
